---
category: Date Time
created: '2021-02-25'
title: Get the current quarter of a date
updated: '2021-10-13'
---

**JavaScript version**

```js getQuarter.js
const getQuarter = (d = new Date()) => Math.ceil((d.getMonth() + 1) / 3);
```

**TypeScript version**

```ts getQuarter.ts
const getQuarter = (d = new Date()): number => Math.ceil((d.getMonth() + 1) / 3);
```
